// checksum 0x9a77 version 0x20001
/*
 * Copyright (c) 2011 Nokia Corporation.
 */
 
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QTime>

#include <QtDeclarative/QDeclarativeView>

#include "level.h"

namespace Ui {
class MainWindow;
}

class View: public QDeclarativeView
{
    Q_OBJECT
public:
    enum ScreenOrientation {
        ScreenOrientationLockPortrait,
        ScreenOrientationLockLandscape,
        ScreenOrientationAuto
    };

    View( QWidget * parent = 0 );
    View( const QUrl & source, QWidget * parent = 0 );
    void setOrientation(ScreenOrientation orientation);
    void showExpanded();
    /***********************************************************************************************
    *The objects fps property accessible from QML.                                                 *
    ***********************************************************************************************/
    Q_PROPERTY (float fps READ fps NOTIFY fpsChanged)
    float fps() const { return m_fps; }

public slots:
    void fittInView(const QRectF & rect);
    void scrollContentsBy(int,int);

signals:
    void fpsChanged();

protected:
    void resizeEvent(QResizeEvent *event);
    void paintEvent ( QPaintEvent * event );

private:
    void init();

private:
    int m_frames;
    QTime m_time;
    float m_fps;
};

#endif // MAINWINDOW_H
